package com.example.netty.bio;

import java.io.OutputStream;

/**
 * 按照HTTP规范从Output输出格式化的字符串
 * @author gorkr
 * @date 2022/07/16 16:41
 **/
public class GPResponse {

    private OutputStream out;

    public GPResponse(OutputStream out){
        this.out = out;
    }

    public void write(String s) throws Exception{
        StringBuilder sb = new StringBuilder();
        sb.append("HTTP/1.1 200 OK\n")
                .append("Content-Type: text/html;\n")
                .append("\r\n")
                .append(s);
        out.write(sb.toString().getBytes());
    }

}
    